package webserver;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;

public class XmlUtils {
	public static Map<String,String> serverXml(String xmlPath) throws Exception{
		SAXBuilder builder = new SAXBuilder();
		Document document = builder.build(new File(xmlPath));
		Element root = document.getRootElement();
		Element portRoot = root.getChild("port");
		String port = portRoot.getValue();
		Element spaceRoot = root.getChild("work-space");
		String space = spaceRoot.getValue();
		Map<String,String> rmap = new HashMap<String,String>();
		rmap.put("port", port);
		rmap.put("workSpace", space);
		return rmap;
	}
}
